import request from '@/assets/js/request';
import util from '@/assets/js/public';
import { getToken, getVersion } from '@/assets/js/auth';

//支出合同创建-获取详情第一步
export function getEsopBusinessToProjectContractByPmInsIdDetails(params) {
  return request(
      {
          url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/' +
              'esopBusinessToProjectContract$api$getEsopBusinessToProjectContractByPmInsIdDetails?pmInsId='+params.pmInsId,
          contentType: 'application/json;charset=UTF-8',
          data: {
              'access_token': getToken(),
              'appCode': 'dict',
              'currentUserCode': util.encrypt(params.userName),
              'versionName': '2.7.92',
              'kv': {
                  'source': 'MOBILE',
                  'currentUserCode': util.encrypt(params.userName),
                  'pmInsId': params.pmInsId
              },
              'jsonName':'appDecision',
              'appDecision':{
                'pmInsId': params.pmInsId
              }
          }
      }
  )
}

//支出合同创建-获取详情第二步
export function getEsopBusinessToProjectByNumberAndPmInsId(params) {
  return request(
      {
          url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/' +
              'esopBusinessToProject$api$getEsopBusinessToProjectByNumberAndPmInsId',
          contentType: 'application/json;charset=UTF-8',
          data: {
              'access_token': getToken(),
              'appCode': 'dict',
              'currentUserCode': util.encrypt(params.userName),
              'versionName': '2.7.92',
              'kv': {
                  'source': 'MOBILE',
                  'currentUserCode': util.encrypt(params.userName),
                  'projectEstablishNumber': params.projectEstablishNumber,
                  'contractSerialNumber': params.contractSerialNumber,
                  'pmInsId': params.pmInsId
              },
          }
      }
  )
}

//支出合同创建-获取详情第三步（完整的详情）
export function getDecisionMakingInfoByProjectEstablishNumber(params) {
  return request(
      {
          url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/' +
              'decisionMaking$api$getDecisionMakingInfoByProjectEstablishNumber',
          contentType: 'application/json;charset=UTF-8',
          data: {
              'access_token': getToken(),
              'appCode': 'dict',
              'currentUserCode': util.encrypt(params.userName),
              'versionName': '2.7.92',
              'kv': {
                  'source': 'MOBILE',
                  'currentUserCode': util.encrypt(params.userName),
                  'projectEstablishNumber': params.projectEstablishNumber,
                  'pmInsId': params.pmInsId,
                  'businessId': params.businessId
              },
          }
      }
  )
}
// 获取合同交底表单详情接口
export function getContractDiscloseByProjectId(params) {
  return request(
      {
          url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/' +
              'contractDisclose$api$getContractDiscloseByProjectId',
          contentType: 'application/json;charset=UTF-8',
          data: {
              'access_token': getToken(),
              'appCode': 'dict',
              'currentUserCode': util.encrypt(params.userName),
              'versionName': '2.7.92',
              'kv': {
                  'source': 'MOBILE',
                  'currentUserCode': util.encrypt(params.userName),
                  'projectId': params.projectInformationId
              },
          }
      }
  )
}

//支出、收入合同变更-获取详情第一步
export function getSupplementContractDetails(params) {
  return request(
      {
          url: process.env.VUE_APP_URL + '/action/openapi/bps/common/transmit/' +
              'esopBusinessToProjectContract$api$getSupplementContractDetails?pmInsId='+params.pmInsId,
          contentType: 'application/json;charset=UTF-8',
          data: {
              'access_token': getToken(),
              'appCode': 'dict',
              'currentUserCode': util.encrypt(params.userName),
              'versionName': '2.7.92',
              'kv': {
                  'source': 'MOBILE',
                  'currentUserCode': util.encrypt(params.userName),
                  'pmInsId': params.pmInsId,
                  'type':'task'
              },
              'jsonName':'appDecision',
              'appDecision':{
                'pmInsId': params.pmInsId
              }
          }
      }
  )
}